package cn.com.dhc.danlu.activity.envelope;

import android.annotation.SuppressLint;

import java.math.BigDecimal;
import java.util.List;

import cn.com.dhc.danlu.util.CalculatePriceUtil;
import cn.com.hd.mall.web.webservices.entity.response.cpx.GetCouponListResponse.CouponListModel;

/**
 * @author wuhaiyang
 */
public class EnvelopDeductionPresenter {
    private BigDecimal mTotalDeductionBd = new BigDecimal(0);

    public EnvelopDeductionPresenter() {
        super();
    }

    public BigDecimal getTotalDeduction() {
        return mTotalDeductionBd;
    }


    @SuppressLint("SetTextI18n")
    public void refreshEnvelops(List<CouponListModel> itemEnvelops) {
        mTotalDeductionBd = new BigDecimal(0);
        for (CouponListModel model : itemEnvelops) {
            BigDecimal facBd = new BigDecimal(model.getFactUse()); // 单位是分
            mTotalDeductionBd = CalculatePriceUtil.addition(mTotalDeductionBd.toPlainString(), facBd.toPlainString());
        }
    }
}